﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.Servico.Infra.FileTransfer.BusinessEntity;
using Sinacor.Servico.Infra.FileTransfer.Service.DataContract.Request;

namespace Sinacor.Servico.Infra.FileTransfer.Service.ServiceImplementation.Translator.DataContractToBusinessEntity
{
    public class FileRepositoryService
    {
        public static FileInfoEntity ToFileInfoEntity(DownloadRequest downloadRequest)
        {
            FileInfoEntity fileInfoEntity = new FileInfoEntity();
            fileInfoEntity.FileName = downloadRequest.VirtualPath;
            fileInfoEntity.ProcessName = downloadRequest.ProcessName;
            fileInfoEntity.CompressionBehavior = (Sinacor.Servico.Infra.FileTransfer.BusinessEntity.CompressionBehavior)downloadRequest.CompressionBehavior;
            return fileInfoEntity;
        }

        public static FileInfoEntity ToFileInfoEntity(FileInfoRequest fileInfoRequest)
        {
            FileInfoEntity fileInfoEntity = new FileInfoEntity();
            fileInfoEntity.FileName = fileInfoRequest.FileName;
            fileInfoEntity.DataStream = fileInfoRequest.DataStream;
            fileInfoEntity.ProcessName = fileInfoRequest.ProcessName;
            fileInfoEntity.CompressionBehavior = (Sinacor.Servico.Infra.FileTransfer.BusinessEntity.CompressionBehavior)fileInfoRequest.CompressionBehavior;
            return fileInfoEntity;
        }

        public static FileInfoEntity ToFileInfoEntity(StorageFileInfoRequest storageFileInfoRequest)
        {
            FileInfoEntity fileInfoEntity = new FileInfoEntity();
            fileInfoEntity.ProcessName = storageFileInfoRequest.ProcessName;
            fileInfoEntity.FileName = storageFileInfoRequest.VirtualPath;
            fileInfoEntity.FolderLocation = (Sinacor.Servico.Infra.FileTransfer.BusinessEntity.FolderLocation)storageFileInfoRequest.FolderLocation;
            return fileInfoEntity;
        }
    }
}
